Emulate guest reads of CR4, masking features that Xen
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 5 Oct 2005 15:54:09 +0000 (16:54 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 5 Oct 2005 15:54:09 +0000 (16:54 +0100)
does not export to guests.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/traps.c

index e0f00d39203832d244a484e410620aa8a7177e46..44f902f50550a9db8d8743dac14d9e230077fce9 100644 (file)
@@ -895,6 +895,14 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
             *reg = pagetable_get_paddr(v->arch.guest_table);
             break;
 
+        case 4: /* Read CR4 */
+            /*
+             * Guests can read CR4 to see what features Xen has enabled. We
+             * therefore lie about PGE & PSE as they are unavailable to guests.
+             */
+            *reg = read_cr4() & ~(X86_CR4_PGE|X86_CR4_PSE);
+            break;
+
         default:
             goto fail;
         }